package com.advantage.accounts.transactions;

import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.advantage.R;

/**
 * Created with IntelliJ IDEA.
 * User: hirsche
 * Date: 13/04/14
 * Time: 20:35
 * To change this template use File | Settings | File Templates.
 */
public class TransactionActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.transaction_main);
        getActionBar().setTitle(R.string.transactions_title);

        TableLayout transactionsTable = (TableLayout)findViewById(R.id.transaction_table);
        Resources resource = getBaseContext().getResources();

        for (int i = 0;i<51;i++) {
            TableRow row = new TableRow(this);
            if (i%2 == 0) {
                row.setBackgroundColor(resource.getColor(R.color.light_gray));
            }

            TextView date = new TextView(this);
            date.setText("1/1/2014");
            date.setGravity(Gravity.CENTER_HORIZONTAL);
            TextView name = new TextView(this);
            name.setText("Money Transfer");
            name.setGravity(Gravity.CENTER_HORIZONTAL);
            TextView debit = new TextView(this);
            debit.setText("$500");
            debit.setGravity(Gravity.CENTER_HORIZONTAL);
            TextView credit = new TextView(this);
            credit.setText("$250");
            credit.setGravity(Gravity.CENTER_HORIZONTAL);
            TextView balance = new TextView(this);
            balance.setText("$350");
            balance.setGravity(Gravity.CENTER_HORIZONTAL);

            row.addView(date);
            row.addView(name);
            row.addView(debit);
            row.addView(credit);
            row.addView(balance);

            transactionsTable.addView(row);
        }



    }
}